//
//  CommunityDetailTableViewCell.m
//  FNer
//
//  Created by 王展 on 15/9/30.
//  Copyright (c) 2015年 wangzhan. All rights reserved.
//

#import "CommunityDetailTableViewCell.h"

@implementation CommunityDetailTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setDetailCell];
    }
    return self;
}

-(void)setDetailCell
{
    UIView *cellView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 375 * XWIDTH, 490 * XHIGHT)];
//    cellView.backgroundColor = [UIColor colorWithRed:245 / 255.0 green:245 / 255.0 blue:245 / 255.0 alpha:1];
    cellView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:cellView];
    
    self.userheadImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10 * XWIDTH, 10 * XHIGHT, 40 * XWIDTH, 40 * XWIDTH)];
    self.userheadImageView.layer.masksToBounds = YES;
    self.userheadImageView.layer.cornerRadius = 20 * XWIDTH;
    self.userheadImageView.backgroundColor = [UIColor whiteColor];
    [cellView addSubview:self.userheadImageView];
    
    self.userNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(60 * XWIDTH, 10 * XHIGHT, 250 * XWIDTH, 15 * XHIGHT)];
//    self.userNameLabel.backgroundColor = [UIColor whiteColor];
    [cellView addSubview:self.userNameLabel];
    self.userNameLabel.textColor = [UIColor colorWithRed:43 / 255.0 green:130 /255.0 blue:199 / 255.0 alpha:1];
    self.userNameLabel.font = [UIFont systemFontOfSize:15* XWIDTH];
    
    self.addressImageView = [[UIImageView alloc] initWithFrame:CGRectMake(60 * XWIDTH, 35 * XHIGHT, 13 * XWIDTH, 16 * XHIGHT)];
    self.addressImageView.image = [UIImage imageNamed:@"地理位置icon@2x.png"];
    [cellView addSubview:self.addressImageView];
    
    self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(80 * XWIDTH, 35 * XHIGHT, 150 * XWIDTH, 15 * XHIGHT)];
//    self.addressLabel.backgroundColor = [UIColor whiteColor];
    [cellView addSubview:self.addressLabel];
    self.addressLabel.textColor = [UIColor lightGrayColor];
    self.addressLabel.font = [UIFont systemFontOfSize:15 * XWIDTH];
    
//    self.addImageView = [[UIImageView alloc] initWithFrame:CGRectMake(310 * XWIDTH, 20 * XHIGHT, 20 * XWIDTH, 20 * XWIDTH)];
//    self.addImageView.image = [UIImage imageNamed:@"关注icon@2x.png"];
//    [cellView addSubview:self.addImageView];
    
//    self.addLabel = [[UILabel alloc] initWithFrame:CGRectMake(330 * XWIDTH, 20 * XHIGHT, 60 * XWIDTH, 20 * XHIGHT)];
//    self.addLabel.text = @"关注";
//    self.addLabel.font = [UIFont systemFontOfSize:16 * XWIDTH];
//    self.addLabel.textColor = [UIColor colorWithRed:43 / 255.0 green:130 /255.0 blue:199 / 255.0 alpha:1];
//    [cellView addSubview:self.addLabel];
    
    self.contentImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10 * XWIDTH, 60 * XHIGHT, WIDTH - 10 * XWIDTH * 2, 350 * XHIGHT)];
    self.contentImageView.backgroundColor = [UIColor whiteColor];
    [cellView addSubview:self.contentImageView];

    self.contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(10 * XWIDTH, 410 * XHIGHT, WIDTH - 10 * XWIDTH * 2, 70 * XHIGHT)];
    self.contentLabel.backgroundColor = [UIColor whiteColor];
    self.contentLabel.textColor = [UIColor grayColor];
    self.contentLabel.numberOfLines = 0;
    self.contentLabel.font = [UIFont systemFontOfSize:15 * XWIDTH];
    [cellView addSubview:self.contentLabel];
    
//    self.likeView = [[UIView alloc] initWithFrame:CGRectMake(10 * XWIDTH, 485 * XHIGHT, 60 * XWIDTH, 25 * XHIGHT)];
//    self.likeView.backgroundColor = [UIColor whiteColor];
//    [cellView addSubview:self.likeView];
    
//    self.likeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5 * XWIDTH, 5 * XHIGHT, 17 * XWIDTH, 14 * XHIGHT)];
//    self.likeImageView.image = [UIImage imageNamed:@"主页button_icon_like@2x.png"];
//    [self.likeView addSubview:self.likeImageView];
    
//    self.likeCountLabel = [[UILabel alloc] initWithFrame:CGRectMake(24 * XWIDTH, 5 * XHIGHT, 30 * XWIDTH, 14 * XHIGHT)];
//    self.likeCountLabel.backgroundColor = [UIColor clearColor];
//    self.likeCountLabel.textAlignment = NSTextAlignmentCenter;
//    self.likeCountLabel.font = [UIFont systemFontOfSize:14 * XWIDTH];
//    self.likeCountLabel.textColor = [UIColor lightGrayColor];
//    [self.likeView addSubview:self.likeCountLabel];
    
//    self.fenxiangView = [[UIView alloc] initWithFrame:CGRectMake(80 * XWIDTH, 485 * XHIGHT, 60 * XWIDTH, 25 * XHIGHT)];
//    self.fenxiangView.backgroundColor = [UIColor whiteColor];
//    [cellView addSubview:self.fenxiangView];
    
//    self.fenxiangImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5 * XWIDTH, 5 * XHIGHT, 17 * XWIDTH, 14 * XHIGHT)];
//    self.fenxiangImageView.image = [UIImage imageNamed:@"分享_@2x.png"];
//    [self.fenxiangView addSubview:self.fenxiangImageView];
    
//    self.fenxiangLabel = [[UILabel alloc] initWithFrame:CGRectMake(24 * XWIDTH, 5 * XHIGHT, 30 * XWIDTH, 14 * XHIGHT)];
//    self.fenxiangLabel.text = @"分享";
//    self.fenxiangLabel.textAlignment = NSTextAlignmentCenter;
//    self.fenxiangLabel.font = [UIFont systemFontOfSize:14 * XWIDTH];
//    self.fenxiangLabel.textColor = [UIColor lightGrayColor];
//    [self.fenxiangView addSubview:self.fenxiangLabel];
}

-(void)setADetailHT:(DetailHtworld *)aDetailHT
{
    _aDetailHT = aDetailHT;
    [self.contentImageView sd_setImageWithURL:[NSURL URLWithString:self.aDetailHT.titleThumbPath]];
    [self.userheadImageView sd_setImageWithURL:[NSURL URLWithString:self.aDetailHT.aUser.userAvatarL]];
    self.userNameLabel.text = self.aDetailHT.aUser.userName;
    self.addressLabel.text = self.aDetailHT.locationDesc;
    self.contentLabel.text = self.aDetailHT.worldDesc;
    self.likeCountLabel.text = [NSString stringWithFormat:@"%ld",self.aDetailHT.likeCount];
}





@end
